public class ThreadDemo16 {
    public static void main(String[] args) throws InterruptedException {
        Thread mainthread=Thread.currentThread();
        Thread t1=new Thread(()->{
            try {
                System.out.println("开始等待main");
                mainthread.join();
                System.out.println("结束等待main");
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        t1.start();
        System.out.println(mainthread);
        Thread.sleep(1000);
        System.out.println("main结束");
    }
}
